/**
 * 跳转页面方法
 */
export const useToPage = () => {
  const navigateTo = (path: string) => {
    path && uni.navigateTo({ url: path });
  }

  const switchTab = (path: string) => {
    path && uni.switchTab({ url: path });
  }

  const redirectTo = (path: string) => {
    path && uni.redirectTo({ url: path });
  }

  const navigateBack = (obj?: any) => {
    uni.navigateBack(obj);
  }

  return {
    navigateBack,
    navigateTo,
    switchTab,
    redirectTo
  }
}